﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace TruckScale.Converters
{
  public class RadioButtonCheckedConverter : IValueConverter
  {
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
      return value?.Equals(parameter) ?? false;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
      return (value is true) ? parameter : Binding.DoNothing;
    }

  }
}
